<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>上海泛软科技有限公司-后台登陆</title>
<meta name="robots" content="nofollow" />
<meta name=”viewport” content=”width=device-width, initial-scale=1, maximum-scale=1″>
<link href="/Public/Css/admin-style.css" rel="stylesheet" type="text/css" />
<link href="/Public/Css/bootstrap.css" rel="stylesheet" type="text/css" />
<link href="/Public/Css/bootstrap.min.css" rel="stylesheet" type="text/css" />


<script language="javascript" type="text/javascript" src="/Public/Js/jquery.js"></script>
<script language="javascript" type="text/javascript" src="/Public/Js/admin-common.js"></script>
<script language="javascript" type="text/javascript" src="/Public/Js/bootstrap.min.js"></script>
<!--<script language="javascript" type="text/javascript" src="/Public/Js/bootstrap.js"></script> -->
<script language="javascript" type="text/javascript" src="/Public/Js/rock_customer_list.js"></script>
<script language="javascript" type="text/javascript" src="/Public/Js/demo.js"></script>
<script language="javascript" type="text/javascript" src="/Public/Js/blob.js"></script>
<script language="javascript" type="text/javascript" src="/Public/Js/FileSaver.min.js"></script>
<script language="javascript" type="text/javascript" src="/Public/Js/jquery.base64.js"></script>
<script language="javascript" type="text/javascript" src="/Public/Js/jquery-1.10.2.min.js"></script>
<script language="javascript" type="text/javascript" src="/Public/Js/tableExport.js"></script>
<script language="javascript" type="text/javascript" src="/Public/Js/xlsx.core.min.js"></script>
</head>

<body>

<style>
  #hedaer{
     background:#B9D3EE;
	 background-color:rgba(185,211,238,0.15);
	 width:100%;
	 height:150px;
	 border-bottom: 1px solid #ccc;
	 overflow:hidden ;
	 padding-left:15px;
	 padding-bottom:0px;
  }
  .select_Sty{
     float:left;
	 
  }
   .select_Sty select {
   width: 150px;
   padding: 2px;
   font-size: 14px;
   border: 1px solid #ccc;
   height: 23px;
   margin-right:20px;
   border-radius:3px
}
 #content #boder{
    padding-left:10px;
	padding-right:10px;
   
 }
 body{
   background-color:rgba(232,232,232,0.25);
 }
 h4{
    font-size: 14px;
	margin-bottom:0px;
 }
 h5{
    font-size: 10px;
 }
 .select_Sty input {
   width: 180px;
   padding: 2px;
   font-size: 14px;
   border: 1px solid #ccc;
   height: 23px;
   margin-right:20px;
   border-radius:3px
}
 #chat{
    margin:0 auto;
 }
 #Echat{
   margin-top:20px;
   text-align:center;
   width:100%;
 }
 #Echat span{
   margin:10px;
   width:30px;
   height:30px;
   padding-top:5px;
   padding-bottom:5px;
   padding-left:30px;
   padding-right:30px;
   border: 1px solid #ccc;
   border-radius:5px;
   background:#D1D1D1;   
   color:#104E8B;
 }
 #next{
   position:absolute;
   top:65%;
   right:160px;
   color:#104E8B;
   border-radius:5px;
   border:none;
   background:#D1D1D1; 
 }
 #prev{
   position:absolute;
   top:65%;
   left:140px;
   color:#104E8B;
   border-radius:5px;
    border:none;
   background:#D1D1D1;
 }
 #prev:hover{
   background:white;
   color:#B23AEE;
 }
 #next:hover{
   background:white;
   color:#B23AEE;
 }
 
</style>

 <div id="background"> 
 <div id="hedaer">
   <h4 id="fileName">数据统计</h4>
   <div class="select_Sty">
   <h5>开始时间:</h5>
   <input name ="0" id="starttime" type="datetime-local" class="se" ></input>
   </div>
   <div class="select_Sty">
   <h5>结束时间:</h5>
   <input name ="1" id="endtime" type="datetime-local" class="se"></input>
   
   </div>	
   <div class="select_Sty">
   <h5>省份:</h5>
    <select class="se" name="h_province">
	  <option value ="请选择">请选择</option>
	  <?php if(is_array($province_data)): $i = 0; $__LIST__ = $province_data;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$list): $mod = ($i % 2 );++$i;?><option value ="<?php echo ($list['pro']); ?>"><?php echo ($list["pro"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
    </select>
   </div>	
    <div class="select_Sty">
     <h5>区、县:</h5>
    <select class="se" name="h_city">
	  <option value ="请选择">请选择</option>
	  <?php if(is_array($city_data)): $i = 0; $__LIST__ = $city_data;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$list1): $mod = ($i % 2 );++$i;?><option value ="<?php echo ($list1['city']); ?>"><?php echo ($list1["city"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
    </select>
   </div>
   <div class="select_Sty">
     <h5>医院:</h5>
    <select class="se" name="h_name" >
	  <option value ="请选择">请选择</option>
	  <?php if(is_array($hospital_data)): $i = 0; $__LIST__ = $hospital_data;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$list2): $mod = ($i % 2 );++$i;?><option value ="<?php echo ($list2['name']); ?>"><?php echo ($list2["name"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
    </select>
   </div>
   <div class="select_Sty">
     <h5>挂号类型:</h5>
    <select class="se" name = "dp_name">
	   <option value ="请选择">请选择</option>
	  <?php if(is_array($num_type)): $i = 0; $__LIST__ = $num_type;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$list3): $mod = ($i % 2 );++$i;?><option value ="<?php echo ($list3['type']); ?>"><?php echo ($list3["type"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
    </select>
   </div>
   <div class="select_Sty" style="display:none">
     <h5>科室:</h5>
    <select>
	  <option value ="volvo">Volvo</option>
	  <option value ="saab">Saab</option>
	  <option value="opel">Opel</option>
	  <option value="audi">Audi</option>
    </select>
   </div>
   <div class="select_Sty">
     <h5>体温:</h5>
    <select class="se" name="t_temperature">
	  <option value ="请选择">请选择</option>
	  <option value ="t0"> <=36.7° </option> <!-- t0 正常 -->
	  <option value="t1">  36.7-38° </option><!-- t1 偏高 -->
	  <option value="t2">  >38° </option>    <!-- t2 高温 -->
    </select>
   </div>
   <div id="search" style="margin-left:230px;margin-top:50px">
    <button type="button"  class="btn btn-primary btn-sm" onclick="search()">查询</button>
   </div>
 </div>   
 <div id="content">
   <div id="boder">
    <div id="items" class="listd" style="width:80%;float:left;">
     <p>items：<span id="cou">加载中...</span></p> 
   </div>
    <div style="width:20%;float:left;text-align:center">
		 <ul style="float:left;font-weight:bold">
		   <li class="listd" style="float:left;margin:2px"><a href="#" id="data_modify" data-toggle="modal" data-target="#myModal1">编辑</a></li>
		   <li  class="listd" style="float:left;margin:2px"><a href="<?php echo U('data_Statistics_Add');?>" >增加</a></li>
		   <li  class="listd" style="float:left;margin:2px"><a id="data_delete" >删除</a></li>
		   <li  class="listd" style="float:left;margin:2px"><a id="device_Export">导出</a></li>
		   <li style="float:left;margin:2px;visibility:hidden">qqq</li>
		   <li style="float:left;margin:2px"><a id="datalist">列表</a></li>
		   <li style="float:left;margin:2px"><a id="datchat">图表</a></li>
		 </ul>
     </div>
 <div id="data_List">	 
	<table class="table table-bordered deviceTblae" style="background:white">
	  <thead style="background-color:rgba(232,232,232,0.35)">
		<tr>
		  <th style="text-align:center"><input  class="all_choose"  type="checkbox"></input></th>
		  <th style="text-align:left">测试时间</th>
		  <th style="text-align:left">省份</th>
		  <th style="text-align:left">所属医院</th>
		  <th style="text-align:left">挂号类型</th>
		  <th style="text-align:right">温度</th>
		  <th style="text-align:right">备注</th>
		</tr>
	  </thead>
	  <tbody  id="list_data">
	  </tbody>
	</table>

<ul class="pagination" id="pagelist" style="float:right;margin:0px">
 
</ul>

   </div>
 </div>
</div>
<!-- <--修改--模态框 --> 
<div class="modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">修改数据</h4>
            </div>
            <div class="modal-body">
			    <form enctype="multipart/form-data" name="form1" method="post" action="<?php echo U('data_modify_ok');?>" class="form-horizontal" role="form" >
				  <div class="form-group">
				  
					<label  for="" class="col-sm-2 control-label">测试时间</label>
					<div class="col-sm-10">
					  <input required="required"  style="width:80%" name="test_time" type="text" class="form-control" id="test_time"></input>
					</div>
					
				  </div>
				    <div class="form-group">
					<label  for="" class="col-sm-2 control-label">省份</label>
					<div class="col-sm-10">
					  <!-- <select style="width:80%" name="province" id="province">
					    <option></option>
					  </select> -->
					  <input readonly required="required" style="width:80%" name="province" type="text" class="form-control" id="province" >
					</div>
				  </div>
				   <div class="form-group">
					<label  for="" class="col-sm-2 control-label">所属医院</label>
					<div class="col-sm-10">
					  <!-- <select style="width:80%" name="hospital_data" id="hospital_data">
					    <option></option>
					  </select> -->
					   <input readonly required="required" style="width:80%" name="hospital_data" type="text" class="form-control" id="hospital_data" >
					
					</div>
				  </div>
				   <div class="form-group">
					<label  for="" class="col-sm-2 control-label">挂号类型</label>
					<div class="col-sm-10" id="dev_tihuan">
					  <select style="width:80%" name="num_style1" id="num_style1">
					   
					  </select> 
					  <input style="display:none" required="required" style="width:80%" name="num_style" type="text" class="form-control" id="num_style" >
					
                     </div>
				  </div>               
				   <div class="form-group">
					<label  for="" class="col-sm-2 control-label">温度</label>
					<div class="col-sm-10">
					  <input required="required" style="width:80%" name="temperature"  type="text" class="form-control" id="temperature" >
					</div>
				  </div>
				   <div class="form-group">
					<label  for="" class="col-sm-2 control-label">备注</label>
					<div class="col-sm-10">
					  <input required="required" style="width:80%" name="remark" type="text" class="form-control" id="remark" >
					</div>
				  </div>
				  <input style="display:none" name="h_id" id="h_id"></input>
				  <input style="display:none" name="t_id" id="t_id"></input>
				  <input style="display:none" name="dp_id" id="dp_id"></input>
				  <input style="display:none" name="p_id" id="p_id"></input>
				  <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="submit"  class="btn btn-primary">提交</button>
                  </div>
				</form>
			</div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
  </div>
 </div>
 <div id="data_Echat" style="display:none;width:100%"> 
   <div id="Echat">   
	<span  class="e_Btn" id="Day">日</span>
  	<span  class="e_Btn" id="Week">周</span>
	<span  class="e_Btn" id ="Month">月</span>
	<span  class="e_Btn" id = "Year">年</span>
  
   </div>  
    <div id="chat" style="width:800px;height:400px;position:relative;">
   </div>
  <input type="button" id="next" value=">>"></input>
  <input type="button" id="prev" value="<<"></input>
 </div>
 
<script>
  var datalist = document.getElementById("datalist");//列表
  var datachat = document.getElementById("datchat");//图表
  var listData = document.getElementById("data_List");//列表数据
  var chatData = document.getElementById("data_Echat");//图表数据
  datalist.onclick = function(){
    listData.style.display = "";
	chatData.style.display = "none";
	$(".listd").css("visibility","");
  }
  datachat.onclick = function(){
    chatData.style.display = "";
    listData.style.display = "none";
	$(".listd").css("visibility","hidden");
  }
  var delete_data = document.getElementById("data_delete");
  delete_data.onclick = function(){
   var len = $("input[type='checkbox']:checked").length;//删除用户的个数
   if(len == 0){
	   alert("请选择需要删除的用户");
	}else{
	  var data_arr = new Array();//
	  $(".choose").each(function(){
        var f_this = $(this).is(':checked');		
        if(f_this){
			data_arr.push($(this).attr("t_id"));
	     }		
	   })
      var string1 = JSON.stringify(data_arr);//将数组转为json
	  $.ajax({
  	    url: '/javajy/index.php/Admin/Wenlian/data_delete',
  	    type: 'POST',
 	    dataType: 'JSON',//here
		data:{
		   dedata:string1
		 },
 	     success: function(data){
		  alert(data);
		  location.reload(true);                                  
		 }
	   });
     }
  }
  var now = new Date();
  var str_now = now.getFullYear() + "-" + fix((now.getMonth() + 1),2) + "-" + fix(now.getDate(),2) + "T" + fix(now.getHours(),2) + ":" + fix(now.getMinutes(),2);
  var str_yes = now.getFullYear() + "-" + fix((now.getMonth() + 1),2) + "-" + fix(now.getDate()-10,2) + "T" + fix(now.getHours(),2) + ":" + fix(now.getMinutes(),2);
  data_Statistics_Data("no");//初始化列表数据
  document.getElementById('starttime').value= str_yes;//给开始时间赋值
  document.getElementById('endtime').value= str_now;//给结束时间赋值
  //其中fix函数就是用来填充不满位的0的，如 fix(8,3)，得到的就是 008
  function fix(num, length) {
    return ('' + num).length < length ? ((new Array(length + 1)).join('0') + num).slice(-length) : '' + num;
  }
  //存放日 周 月 年 
  localStorage.day= 0;//公共的
  var day1 = [];//日
  var week = [];//周
  var month = [];//月
  var year = [];//年
 //ajax异步加载列表数据
 function data_Statistics_Data(string){
   $.ajax({
  	    url: '/javajy/index.php/Admin/Wenlian/data_Statistics_Data',
  	    type: 'POST',
 	    dataType: 'JSON',//here
		data:{
		    str:string
		 },
 	     success: function(obj){
		  var data = obj[0];
		  var html = ''
      var pagesize=20; 
      var len;
      var _len=data.length;
      if(data.length<20){
            len=data.length;
         }else{
           len=20;

         }
      for(var i = 0; i <len;i++){
		   html+=
		    '<tr>'
		    +'<td style="text-align:center"><input p_id='+data[i]["p_id"]+' dp_id='+data[i]["dp_id"]+' t_id='+data[i]["t_id"]+' h_id='+data[i]["h_id"]+' type="checkbox" class="choose"></input></td>'
		    +'<td style="text-align:left">'+data[i]["t_time"]+'</td>'
		    +'<td style="text-align:left">'+data[i]["h_province"]+'</td>'
		    +'<td style="text-align:left">'+data[i]["h_name"]+'</td>'
		    +'<td style="text-align:left">'+data[i]["dp_name"]+'</td>'
		    +'<td style="text-align:right">'+data[i]["t_temperature"]+'°</td>'
		    +'<td style="text-align:right">'+data[i]["remark"]+'</td>'	 
		    +'</tr>'
		 
           document.getElementById("list_data").innerHTML = html;	
           document.getElementById("cou").innerHTML = data.length;	
      }
      var  count=Math.ceil(_len/20);
      var pagehtml='';
      if(_len>20){
        $('#pagelist').empty();
         for(var i=1;i <= count;i++){

          pagehtml='';
          pagehtml +=
              '<li id='+i+'><a href="#">'+i+'</a></li>'
 
            $('#pagelist').append(pagehtml);

        }
        $('#pagelist li').each(function(){

           $(this).click(function(){

               var id=$(this).attr('id');
               var startid=(id-1)*20;
               var endid=id*20;
               if(endid<_len){
                  endid=endid;

               }else{
                endid=_len;
               }
               $('#list_data').empty();
          var _html='';
        for(var i = startid; i <endid;i++){
         debugger;
          _html +=
        '<tr>'
        +'<td style="text-align:center"><input p_id='+data[i]["p_id"]+' dp_id='+data[i]["dp_id"]+' t_id='+data[i]["t_id"]+' h_id='+data[i]["h_id"]+' type="checkbox" class="choose"></input></td>'
        +'<td style="text-align:left">'+data[i]["t_time"]+'</td>'
        +'<td style="text-align:left">'+data[i]["h_province"]+'</td>'
        +'<td style="text-align:left">'+data[i]["h_name"]+'</td>'
        +'<td style="text-align:left">'+data[i]["dp_name"]+'</td>'
        +'<td style="text-align:right">'+data[i]["t_temperature"]+'°</td>'
        +'<td style="text-align:right">'+data[i]["remark"]+'</td>'   
        +'</tr>'
            document.getElementById("list_data").innerHTML = _html; 
            document.getElementById("cou").innerHTML =_len;  
         }

           })

        })

      }



          //单选
		  $(".choose").click(function(){
		   //var u_id = $(this).attr("u_id").substr(1);
		   var all_choose = $(".all_choose").is(':checked');
		   if(all_choose){
		  	  $(".all_choose").prop('checked',false);
			 }
		   });
	       day1 = obj[1];
		   week = obj[2];//localStorage.day
		   month = obj[3];//
		   year = obj[4];//
		  
		  //加载图表数据
		  if(localStorage.day == 0){//天
		   var day2 = firstShow(day1);
		   chatDataFun(day2);
		  }else if(localStorage.day == 1){//周
		    var week1 = firstShow(week);
		    chatDataFun(week1);
		  }else if(localStorage.day == 2){//月
		    var month1 = firstShow(month);
		    chatDataFun(month1);
		  }else if(localStorage.day == 3){//年
		   var year1 = firstShow(year);
		   chatDataFun(year1);
		  }
		   
		 }
	});
 }
 //限制页面最多显示15条数据  localStorage.day = 0;
 
 var next = document.getElementById("next");
 var prev = document.getElementById("prev");
 var start = 0;
 var end = 15;
 var allData = '';
 var flag = 1;

 //上一页
 prev.onclick = function(){
  flag = 0; //start = 15 end = 30  30 45  45 60
  start-=15;
  end-=15;
  if(localStorage.day == 0){//日
    var day_data = limitData(day1,start,end);
	chatDataFun(day_data);
  }else if(localStorage.day == 1){//周
    var day_data = limitData(week,start,end);
	chatDataFun(day_data);
  }else if(localStorage.day == 2){//月
    var day_data = limitData(month,start,end);
	chatDataFun(day_data);
  }else if(localStorage.day == 3){//年
    var day_data = limitData(year,start,end);
	chatDataFun(day_data);
  }
 }
 //下一页
 next.onclick = function(){
  flag = 1;
   start = end;
   end = start + 15;  //start = 15 end = 30  30 45  45 60
  if(localStorage.day == 0){//日
    var day_data = limitData(day1,start,end);
	chatDataFun(day_data);
  }else if(localStorage.day == 1){//周
    var day_data = limitData(week,start,end);
	chatDataFun(day_data);
  }else if(localStorage.day == 2){//月
    var day_data = limitData(month,start,end);
	chatDataFun(day_data);
  }else if(localStorage.day == 3){//年
    var day_data = limitData(year,start,end);
	chatDataFun(day_data);
  }
}

 function limitData(data,start1,end1){
   debugger;
   var length = data[0].length;
   var d = data[0].slice(start1,end1);
   var d1 = data[1].slice(start1,end1);
   var d2 = data[2].slice(start1,end1);
   if(flag == 1){//下一页
     if(d.length > 0 && d.length <= 15){
	   var data = [];
       data.push(d,d1,d2);
	   return data;
     }else{
	    start = start - 15;
		end = end - 15;
        alert("没有更多数据");
    }
   }else{//上一页
      if(start >= 0){
	    var data = [];
        data.push(d,d1,d2);
	    return data;
     }else{
	    start = 0;
	    end = 15;
        alert("没有更多数据");
    }
   } 
 }
 //首次显示15条数据
 function firstShow(data){
   var d = data[0].slice(0,15);
   var d1 = data[1].slice(0,15);
   var d2 = data[2].slice(0,15);
   var day = [];
   day.push(d,d1,d2);
   return day;
 }
 
 //图表数据
 function chatDataFun(day){
   // day = firstShow(day);
    var arrX = [];
    var arrLegend = ['<=36.7', '36.7-38','>38'];
    var arrDa1 = [];
    var arrDa2 = [];
    var arrDa3 = [];
	debugger;
    // 指定图表的配置项和数据
    for(var i = 0; i < day[0].length; i++){//正常
         arrX.push(day[0][i][0]);
	     arrDa1.push(day[0][i][1]);  
      }
	for(var j = 0; j < day[1].length; j++){//偏高
         arrDa2.push(day[1][j][1]);  
      }
	for(var k = 0; k < day[2].length; k++){//高温
         arrDa3.push(day[2][k][1]);  
     }
	 // 基于准备好的dom，初始化echarts实例
	var myChart = echarts.init(document.getElementById('chat')); 
	Opt(arrX,arrLegend,arrDa1,arrDa2,arrDa3);
    myChart.setOption(option);
   
 } 
 //全选
  $(".all_choose").click(function(){
    var flag = $(this).is(':checked');
	if(flag){
      $(".choose").each(function(){
      $(this).prop('checked',true);
    })
	}else{
	  $(".choose").each(function(){
		 $(this).prop('checked',false);
	   })
	 }
  })
  //查找
  function search(){
   end = 15;
   start = 0;
   
   var arr = {};
   $(".se").each(function(){
	  var value = $(this).val();
	  if($(this).val()!="请选择"){
		var name = $(this).attr("name");
		var name1 = name.substr(0,1);
		name = name1+"."+name;
		arr[name] = value; 
	  }
  });
  var string = JSON.stringify(arr);//将数组转为json
  data_Statistics_Data(string);
 }
 //修改
 $("#data_modify").click(function (){
   var len = $("input[type='checkbox']:checked").length;//修改数据的个数
    if(len == 0){
	   alert("请选择修改的用户");
	   return false;
	 }else if(len!=1){
	   alert("每次只能修改一个用户数据");
	   return false;
	 }
	var t_id = '';
	var h_id = '';
	var dp_id = '';
	$(".choose").each(function(){
        var f_this = $(this).is(':checked');		
        if(f_this){
		    t_id = $(this).attr("t_id");
		    h_id = $(this).attr("h_id");
			dp_id = $(this).attr("dp_id");
			p_id = $(this).attr("p_id");
		}		
	 }) 
	 $.ajax({
  	    url: '/javajy/index.php/Admin/Wenlian/data_Statistics_info',
  	    type: 'POST',
 	    dataType: 'JSON',//here
		data:{
		   h_id:h_id,
		   t_id:t_id,
		   dp_id:dp_id,
		   p_id:p_id
		 },
 	     success: function(data){
		   if(!data[0][0]["remark"]){
		     data[0][0]["remark"]="无";
		   } 
		   $("#test_time").val(data[0][0]["t_time"]);//测试时间
		   $("#temperature").val(data[0][0]["t_temperature"]);//温度
		   $("#remark").val(data[0][0]["remark"]);//备注
		   $("#province").val(data[1][0]["h_province"]);//省份
		   $("#hospital_data").val(data[1][0]["h_name"]);//所属医院
		   
		   $("#h_id").val(h_id);
		   $("#t_id").val(t_id);
		   $("#dp_id").val(dp_id);
		   $("#p_id").val(p_id);
		   //挂号类型
		   var ntyle = '';
		   for(var i = 0; i < data[3].length; i++){
		      ntyle+=
			  '<option dp_id ='+data[3][i]["dp_id"]+' >'+data[3][i]["dp_name"]+'</option>'
		   }
		   $("#num_style1").html(ntyle);
		   $("#num_style1").val(data[2][0]["dp_name"]);//挂号类型
		   $("#num_style").val(dp_id);//挂号类型
		   document.getElementById("num_style1").onchange = function(){
		      var dpid = $("#num_style1").find("option:selected").attr("dp_id"); 
			  $("#num_style").val(dpid);//挂号类型
		   }
		 }
	   });
 });
 /////////////////////////图表数据
 function Opt(arr,arrLegend,arrDa1,arrDa2,arrDa3){
   option = {
    tooltip : {  //tooltip气泡提示框，常用于展现更详细的数据
        trigger: 'axis',
		formatter:function(params){  
           var relVal = params[0].name;  
           for (var i = 0, l = params.length; i < l; i++) {  
                relVal += '<br/>' + params[i].seriesName + ' : ' + params[i].value+"个";  
            }  
           return relVal;  
        },  
        axisPointer : {            // 坐标轴指示器，坐标轴触发有效
            type : 'shadow',        // 默认为直线，可选为：'line' | 'shadow'
        }
    },
    xAxis:  {
	     axisLabel: {
          rotate: 20,
		  interval:0   
         },
		 
         type: 'category',
         data: arr
    },
    yAxis: {
	   type: 'value',
	   axisLabel : {
         formatter: '{value} 个'
       },
    },
	color:['#228B22','#FFC125','#FF8C00'],
	legend: {
	    orient: 'vertical',      // 布局方式，默认为水平布局，可选为：
                                   // 'horizontal' ¦ 'vertical'
        x: 'right',               // 水平安放位置，默认为全图居中，可选为：
                                   // 'center' ¦ 'left' ¦ 'right'
                                   // ¦ {number}（x坐标，单位px）
        y: 'top',                  // 垂直安放位置，默认为全图顶端，可选为：
                                   // 'top' ¦ 'bottom' ¦ 'center'
                                   // ¦ {number}（y坐标，单位px）
        backgroundColor: 'rgba(0,0,0,0)',
          
        itemGap: 10,               // 各个item之间的间隔，单位px，默认为10，
                                   // 横向布局时为水平间隔，纵向布局时为纵向间隔
        itemWidth: 20,             // 图例图形宽度
        itemHeight: 20,            // 图例图形高度
        textStyle: {
            color: '#333'          // 图例文字颜色
        },
        data: arrLegend//['<=36.7', '36.7-38','>38']
    },
    series: [//series 数据系列，一个图表可能包含多个系列，每一个系列可能包含多个数据
        { 
		    barWidth:40,
            name: '<=36.7',
            type: 'bar',
            stack: '总个数',
            label: {
                normal: {
                    show: true,
                    position: 'insideRight',
                }
            },
            data: arrDa1,
        },
        {   
		    barWidth:40,
            name: '36.7-38',
            type: 'bar',
            stack: '总个数',
			
            label: {
                normal: {
                    show: true,
                    position: 'insideRight',	
                }
            },
            data: arrDa2,
        },
        {
		    barWidth:40,
            name: '>38',
            type: 'bar',
            stack: '总个数',
            label: {
                normal: {
                    show: true,
                    position: 'insideRight',
                }
            },
            data: arrDa3,
        }
    ]
   }; 
 } 
 
 //默认第一个选中
 $(".e_Btn").eq(0).css("background","#4682B4"); 
 $(".e_Btn").eq(0).css("color","white");
 //日周月年按钮点击切换样式
 $(".e_Btn").each(function(){
   $(this).click(function(){
     var Oid = this.id;
     if(Oid == "Day"){//天
	    //= firstShow(day1);
		var day3  = limitData(day1,0,15);
	    chatDataFun(day3);
		localStorage.day = 0;
		end = 15;
		start = 0;
	 }else if(Oid == "Week"){//周
	   // var week2 = firstShow(week);
	   var week2  = limitData(week,0,15);
	   chatDataFun(week2);
	   localStorage.day = 1;
	   end = 15;
	   start = 0;
	 }else if(Oid == "Month"){//周
	   //var month2 = firstShow(month);
	   var month2  = limitData(month,0,15); 
	   chatDataFun(month2);
	   localStorage.day = 2;
	   end = 15;
	   start = 0;
	 }else if(Oid == "Year"){//年
	  //var year2 = firstShow(year);
	  var year2  = limitData(year,0,15); 
	   chatDataFun(year2);
	   localStorage.day = 3;
	   end = 15;
	   start = 0;
	 }
   
     $(".e_Btn").css("background","#D1D1D1");
	 $(".e_Btn").css("color","#104E8B");
     $(this).css("background","#4682B4");
	 $(this).css("color","white");
   }) 
 })
 //获取日期与时间
 function getNowFormatDate() {
    var date = new Date();
    var seperator1 = "-";
    var year = date.getFullYear();
    var month = date.getMonth() + 1;
    var strDate = date.getDate();
	var hours = date.getHours(); //获取当前小时数(0-23)
    var min =  date.getMinutes(); //获取当前分钟数(0-59)
    var second = date.getSeconds(); //获取当前秒数(0-59)
	
    if (month >= 1 && month <= 9) {
         month = "0" + month;
    }
    if (strDate >= 0 && strDate <= 9) {
        strDate = "0" + strDate;
    }
	if(hours >=0 && hours <= 9){
	   hours = "0" + hours;
	}
	if(min >=0 && min <= 9){
	   min = "0" + min;
	}
	if(second >=0 && second <= 9){
	   second = "0" + second;
	}
    var currentdate = year + seperator1 + month + seperator1 + strDate +" "+hours +"时" + min+"分" + second+"秒";
    return currentdate;
 } 
 //导出exce
 var exportData = document.getElementById("device_Export");
 exportData.onclick = function(){
    //$(".deviceTblae").tableExport({ type: 'excel', separator: ';', escape: 'false' });
	var fName = $("#fileName").html();
	var currentTime =  getNowFormatDate();
	fName = fName+'_'+currentTime;
	$(".deviceTblae").tableExport({ type: 'excel', separator: ',', escape: 'false',fileName:fName });
 }
</script>

</body>
</html>